package com.example.demo.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.entity.SaleOrder;
import com.example.demo.service.ISaleOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author cici
 */
@RestController
@Api(tags = "销售单单相关接口")
@RequestMapping("/sale")
public class SaleOrderController {

    @Autowired
    private ISaleOrderService saleOrderService;

    @PostMapping(value = "/create")
    @ApiOperation(value = "新增", notes = "传入purchaseOrder")
    public SaleOrder create(@RequestBody SaleOrder saleOrder){
        return saleOrderService.create(saleOrder);
    }

    @GetMapping(value = "/detail/{id}")
    @ApiOperation(value = "查询", notes = "传入id")
    public SaleOrder detail(@PathVariable("id") Integer id){
        return saleOrderService.detail(id);
    }

    @GetMapping(value = "/page")
    @ApiOperation(value = "查询", notes = "传入id")
    public IPage<SaleOrder> page(Page<SaleOrder> page, SaleOrder saleOrder){
        return saleOrderService.selectPage(page,saleOrder);
    }
}
